package com.maotai.llzhou.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component("maotaiDao")
@Transactional
public class MaotaiDao extends CommonDao{
	
	public List<Map<String, Object>> queryMaotaiOrderItem(Map<String, String> map)throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.queryMaotaiOrderItem", map);
    }
	public List<Map<String, Object>> getMaotaiCodeItem(Map<String, String> map)throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getMaotaiCodeItem", map);
    }
	public List<Map<String, Object>> getMaotaiOrderItem(Map<String, String> map)throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getMaotaiOrderItem", map);
    }
	public List<Map<String, Object>> getAddressByName(Map<String, String> map)throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getAddressByName", map);
    }
	public List<Map<String, Object>> getZhanghaoAuditLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoAuditLogin");
    }
	public List<Map<String, Object>> getZhanghaoCheck()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoCheck");
    }
	public List<Map<String, Object>> getAddressLibrary()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getAddressLibrary");
    }
	public List<Map<String, Object>> getZhanghaoUpdateAddress()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoUpdateAddress");
    }
	public List<Map<String, Object>> getZhanghaoCheckLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoCheckLogin");
    }
	public List<Map<String, Object>> getZhanghaoBuyLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoBuyLogin");
    }
	public List<Map<String, Object>> getZhanghaoQueryOrderLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoQueryOrderLogin");
    }
	public List<Map<String, Object>> getZhanghaoQueryWuLiuLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoQueryWuLiuLogin");
    }
	public List<Map<String, Object>> getZhanghaoYuYueLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoYuYueLogin");
    }
	public List<Map<String, Object>> getZhanghaoYuYueCheckLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoYuYueCheckLogin");
    }
    public List<Map<String, Object>> getZhanghaoHasOrder()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoHasOrder");
    }
    public List<Map<String, Object>> getZhanghaoWuLiu()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoWuLiu");
    }
	public List<Map<String, Object>> getZhanghaoYuYue()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoYuYue");
    }
	public List<Map<String, Object>> getZhanghaoYuYueNew()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoYuYueNew");
    }
	public List<Map<String, Object>> getZhanghaoInit()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoInit");
    }
	public List<Map<String, Object>> getZhanghaoYuYueCheck()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoYuYueCheck");
    }
	public List<Map<String, Object>> getZhanghaoLogin()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoLogin");
    }
	public List<Map<String, Object>> getShenFengList()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getShenFengList");
    }
	public List<Map<String, Object>> getTokenList()throws SQLException{
        return this.getSqlSession().selectList("com.maotai.llzhou.dao.MaotaiMapper.getTokenList");
    }
    public Map<String, Object> getPersonName()throws SQLException{
        return this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getPersonName");
    }
    public Map<String, Object> getCountryRandom()throws SQLException{
        return this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getCountryRandom");
    }
    
    public Map<String, Object> getCountryRandomNew(Map<String, Object> map)throws SQLException{
//    	String sql=this.getSqlSession().getConfiguration().getMappedStatement("com.maotai.llzhou.dao.MaotaiMapper.getCountryRandomNew").getBoundSql(map).getSql();
//        System.out.println(sql);
//        return this.getSqlSession().selectOne(sql);
    	return this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getCountryRandomNew",map);
    }
    public Map<String, Object> getCountryRandomMY()throws SQLException{
        return this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getCountryRandomMY");
    } 
    public Map<String, Object> getTokenRandom()throws SQLException{
        return this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getTokenRandom");
    } 
    public Map<String, Object> getShenFengRandom()throws SQLException{
        return this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getShenFengRandom");
    } 
    public Map<String, Object> getRegisterPhone()throws SQLException{
        return this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getRegisterPhone");
    }  
	public int insertZhanghaoAddress(Map<String, Object> map)throws SQLException{
		Map<String, Object> yuyueitemOne = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoAddressOne",map);
		if(yuyueitemOne!=null) return 1;
		else
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertZhanghaoAddress",map);
	}
	public int insertZhanghaoWeb(Map<String, String> map)throws SQLException{
		Map<String, Object> yuyueitemOne = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoOne",map);
		if(yuyueitemOne!=null) return 1;
		else
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertZhanghaoWeb",map);
	}
	public int insertZhanghaoOrderItem(Map<String, Object> map)throws SQLException{
		Map<String, Object> yuyueitemOne = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoOrderItemOne",map);
		if(yuyueitemOne!=null) return 1;
		else
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertZhanghaoOrderItem",map);
	}
	public int insertZhanghaoInvoice(Map<String, Object> map)throws SQLException{
		Map<String, Object> yuyueitemOne = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoInvoiceOne",map);
		if(yuyueitemOne!=null) return 1;
		else
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertZhanghaoInvoice",map);
	}
	public int insertZhanghaoCookie(Map<String, Object> map)throws SQLException{
		Map<String, Object> yuyueitemOne = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoCookieOne",map);
		if(yuyueitemOne!=null) return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoCookie",map);
		else
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertZhanghaoCookie",map);
	}
	public int insertZhanghaoYuYueItem(Map<String, Object> map)throws SQLException{
		Map<String, Object> yuyueitemOne = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoYuYueItemOne",map);
		if(yuyueitemOne!=null) return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoYuYueItem",map);
		else return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertZhanghaoYuYueItem",map);
	}
	
	public int updateZhanghaoYuYueStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoYuYueStatus",map);
	}
	public int updateZhanghaoInitStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoInitStatus",map);
	}
	public int updateShenFenStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateShenFenStatus",map);
	}
	public int updateZhanghaoYuYueStatusNotTime(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoYuYueStatusNotTime",map);
	}
	public int updateZhanghaoOrderStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoOrderStatus",map);
	}
	public int updateZhanghaoStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoStatus",map);
	}
	public int updateZhanghaoYuYueCheckStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoYuYueCheckStatus",map);
	}
	public int updateZhanghaoBuyStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoBuyStatus",map);
	}
	
	public int updateZhanghaoLoginStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoLoginStatus",map);
	}
	public int updateZhanghaoAuth(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoAuth",map);
	}
	public int updateZhanghaoInvoiceId(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoInvoiceId",map);
	}
	public int updateZhanghaoAddressId(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoAddressId",map);
	}
	public int updateZhanghaoMemberId(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoMemberId",map);
	}
	public int updateZhanghaoCheckStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoCheckStatus",map);
	}
	public int updateAddressLibraryStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.updateAddressLibraryStatus",map);
	}
	public int updateZhanghaoOrderItem(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoOrderItem",map);
	}
	public int updateZhanghaoOrderItemUpdateTime(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoOrderItemUpdateTime",map);
	}
	public int insertZhanghaoItem(Map<String, Object> map)throws SQLException{
		Map<String, Object> result = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getZhanghaoItem",map);
		if(result!=null && result.get("orderid")!=null){
			return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateZhanghaoItem",map);
		}else{
			return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertZhanghaoItem",map);
		}
	}
	public int addMaotaiCode(Map<String, String> map)throws SQLException{
		Map<String, Object> result = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getMaotaiCode",map);
		if(result!=null && result.get("code")!=null){
			return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateMaotaiCode",map);
		}else{
			return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.addMaotaiCode",map);
		}
	}
	public int insertMaotaiAudit(Map<String, Object> map)throws SQLException{
		Map<String, Object> result = this.getSqlSession().selectOne("com.maotai.llzhou.dao.MaotaiMapper.getMaotaiAudit",map);
		if(result!=null && result.get("code")!=null){
			return 1;
		}else{
			return this.getSqlSession().insert("com.maotai.llzhou.dao.MaotaiMapper.insertMaotaiAudit",map);
		}
	}
	public int updateRegisterPhoneStatus(Map<String, Object> map)throws SQLException{
		return this.getSqlSession().update("com.maotai.llzhou.dao.MaotaiMapper.updateRegisterPhoneStatus",map);
	}
}
